<?php

/**
 * 
 */
App::uses('AppModel', 'Model');

class Users extends AppModel {

    public $useTable = 'users';
    public $name = 'Users';
   
    public $hasMany = array(
        // A User has many quotes to post.
        'Quotes_Post_By' => array(
            'className' => 'Quotes',
            'foreignKey' => 'post_by',
            'conditions' => array('valid' => 1)
        ),
        // A User has many quotes to modify.
        'Quotes_Modify_By' => array(
            'className' => 'Quotes',
            'foreignKey' => 'modify_by',
            'conditions' => array('valid' => 1)
        )
    );
    
    //Validation 
    public $validate = array(
        'name' => array(
            'rule' => 'alphaNumeric',
            'required'  => true,
            'message'   => 'Input your Name please!!!'
        ),
        'email' => array(
            'rule' => 'email',
            'required'  => true,
            'message'   => 'Input your Email please!!!'
        ),
        'facebook_id' => array(
            'required'  => true,
        ),
        'date_registered' => array(
            'rule' => 'date',
            'required'  => true,
        ),
        'valid' => array(
            'required'  => true,
        ),
        'group' => array(
            'required'  => true,
        )
        
    );
}